#include <stdio.h>
#include <stdlib.h>

class NonCopyable {
	public:
		int m0;

	public:
//		NonCopyable(int a) { };
		NonCopyable() { m0 = 10; printf("noncopyable constr\n"); }

		NonCopyable(const NonCopyable& obj) { printf("noncopyable copy\n"); }
	private:
		NonCopyable operator=(const NonCopyable& obj);
};

class TryToCopy : public NonCopyable {
	public:
		TryToCopy()  {
			mA = 0;
			mA = 0;
		};

		TryToCopy(const TryToCopy& obj) : NonCopyable(obj) {
			printf("trytocopy copy ctor\n");
			mA = obj.mA;
			mB = 4;
		};

	public:
		int mA;
		int mB;
};

int main()
{
	TryToCopy obj1;
	TryToCopy obj2 = obj1;
	obj1.mA = 1;
	obj1.mB = 1;
//	obj2 = obj1;
	printf("obj2.m0 = %d\n", obj2.m0);
	return 0;
}
